﻿#pragma once
#include "afxdialogex.h"
#include "CLogRecord.h"
#include "CColorListCtrl.h"
#include <vector>
// CLogDialog 对话框
using namespace std;
#define LV_ALL              0x0000
#define LV_INFO            0x0001
#define LV_DEBUG          0x0002  // Same as LVFI_PARTIAL
#define LV_ERROR            0x0004
#define LV_IMPORTANT          0xFFFF
class CLogDialog : public CDialogEx
{
	DECLARE_DYNAMIC(CLogDialog)

public:
	CLogDialog(CWnd* pParent = nullptr);   // 标准构造函数
	CLogDialog(CWnd* pParent = nullptr, string fileDir="");
	virtual ~CLogDialog();
	virtual BOOL OnInitDialog();
// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_DIALOG_VIEW };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
private:
	CEdit M_EditSearch;
	CButton m_SearchBtn;
	CColorListCtrl m_LogViewList;
	vector<CLogRecord> m_vLogRecord;
	vector<CLogRecord> m_vLogShow;
	string m_FileDir;
	int m_SearchIndex;//搜索开始索引
	int m_FilterLevel;
	CButton m_SearchNext;
	CButton m_RadioError;
	CButton m_RadioDebug;
	CButton m_RadioInfo;
	CButton m_RadioAll;
	CButton m_RadioImport;
private:
	//根据日志容器显示日志到list中
	void SetLogShow();
	//根据combo选择的日志等级筛选日志
	void CLogDialog::FilterLogVector();
	//初筛出重要日志
	void FilterImportantVector(vector<CLogRecord>& vLogRecord);
public:
	afx_msg void OnBnClickedButtonSearch();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

	afx_msg void OnBnClickedRadioError();
	afx_msg void OnBnClickedRadioDebug();
	afx_msg void OnBnClickedRadioInfo();
	afx_msg void OnBnClickedRadioAll();
	afx_msg void OnBnClickedRadioImport();
	CStatic m_StaticResult;
};
